package com.bw.doctor.controller;
/**
 * @Author：尚志豪
 * @Package：com.bw.doctor.controller
 * @Project：doudi-group2-shixun-02
 * @name：RapidConsultationController
 * @Date：2025/2/27 10:07
 */
import com.bw.common.core.web.controller.BaseController;
import com.bw.common.redis.service.RedisService;
import com.bw.domain.Doctor;
import com.bw.domain.Register;
import com.bw.domain.SSymptom;
import com.bw.doctor.service.RapidConsultationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: doudi-group2-shixun-02
 * @description: 快速问诊
 * @author: CuiFu Bo
 * @create: 2025-02-27 10:07
 **/
@RestController
@RequestMapping("rapidConsultation")
public class RapidConsultationController extends BaseController
{
    @Autowired
    public RapidConsultationService rapidConsultationService;
    @Autowired
    private RedisService redisService;
    /**
     * 通过部位查看对应的病症
     */
    @PostMapping("/lookAtTheCorrespondingDiseaseByLocation/{id}")
    public List<SSymptom> lookAtTheCorrespondingDiseaseByLocation(@PathVariable Long id)
    {
        List<SSymptom> list = rapidConsultationService.lookAtTheCorrespondingDiseaseByLocation(id);
        System.out.println("list: " + list);
        return list;
    }

    /**
     * 通过病症查到对应的医生
     */
    @GetMapping("/weCanTraceTheSymptomsToTheDoctor")
    public List<Doctor> weCanTraceTheSymptomsToTheDoctor(@RequestParam String tag)
    {
        List<Doctor> list = rapidConsultationService.weCanTraceTheSymptomsToTheDoctor(tag);
        System.out.println("list: " + list);
        return list;
    }

    /**
     * 挂号
     */
    @PostMapping("/register")
    public void register(@RequestBody Register register)
    {
        rapidConsultationService.register(register);
    }

    /**
     * 取消挂号
     */
    @PostMapping("/cancelRegister")
    public void cancelRegister(@RequestBody Register register)
    {
        rapidConsultationService.cancelRegister(register);
    }

    /**
     * 获取挂号数据
     */
    @PostMapping("/getRegisterData")
    public Integer getRegisterData(@RequestBody Register register)
    {
        Integer registerStatus = rapidConsultationService.getRegisterData(register);
        return registerStatus;
    }

    /**
     * 获取医生名称
     */
    @GetMapping("/getDoctorName")
    public String getRegisterStatus()
    {
        String doctorName = redisService.getCacheObject("doctorName");
        return doctorName;
    }

}
